package com.hh.Optional;

import java.util.Optional;

/**
 * @Author hanghao
 * @Date 2023/5/8 15:15
 * @Version 1.0
 */

public class Test {
    public static void main(String[] args) {
        Student student = new Student();
        Optional<Student> student1 = Optional.of(student);
        System.out.println(student1);

        Student student2 = new Student();
        Optional<Student> student3 = Optional.ofNullable(student2);
//        Student student4 = student3.get();
        Student student4 = student3.orElse(new Student("ddd",18));
        System.out.println(student4);
    }
}
